package qp.parser;

import java.io.IOException;
import java.io.InputStream;
import java.io.StringBufferInputStream;

import java.util.*;
import qp.utils.*;

public class test {
	public static void main(String[]args)
	{
		
		String sone="select distinct test.a,test.b from test orderby test.b desc ";
		String test="select distinct Flights.flno,Schedule.flno,Schedule.aid from Flights,Schedule WHERE Flights.flno=Schedule.flno orderby Flights.flno asc,Schedule.aid desc";
		InputStream instream=new StringBufferInputStream(test);
		Scaner s=new Scaner(instream);
		parser p=new parser();
		p.setScanner(s);
		try{
		    p.parse();
		}catch(Exception e){
		    System.out.println("Exception occured while parsing");
		    System.exit(1);
		}
		SQLQuery sqlquery = p.getSQLQuery();
		int numJoin = sqlquery.getNumJoin();
		
		System.out.print("ProjectList.size: "+sqlquery.getProjectList().size()+" distinct:"+sqlquery.isDistinct()+" orderbylist:"+((Order)sqlquery.orderbyList.elementAt(1)).getAscOrDesc());
	}
}
